<!-- 耗材管理-库存管理-耗材库存 -->
<template>
  <div class="JNPF-common-layout">
    <div class="JNPF-common-layout-center">
      <el-row class="JNPF-common-search-box" :gutter="16">
        <el-form @submit.native.prevent>

          <el-col :span="6">
          <el-form-item label="仓库">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options2"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="耗材名称">
              <el-input v-model="listQuery.fuser" placeholder="请输入编号或名称" clearable />
            </el-form-item>
          </el-col>

          <template v-if="showAll">

            <el-col :span="6">
            <el-form-item label="耗材类型">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options3"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          </template>

          <el-col :span="6">
            <el-form-item label="">
              <el-button type="primary" icon="el-icon-search" >查询</el-button>
              <!-- <el-button type="primary" icon="el-icon-plus" @click="insert(undefined)">新增</el-button> -->
              <el-button type="danger" icon="el-icon-download">导出</el-button>
              <el-button type="text" icon="el-icon-arrow-down" @click="showAll = true" v-if="!showAll">展开</el-button>
              <el-button type="text" icon="el-icon-arrow-up" @click="showAll = false" v-else>收起</el-button>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>

      <div class="JNPF-common-layout-main JNPF-flex-main">
        <JNPF-table :data="list" border v-loading="loading">
          <el-table-column prop="FSTOCK" label="仓库"></el-table-column>
          <el-table-column prop="FCATNO" label="耗材分类" width="95"></el-table-column>
          <el-table-column prop="FCATNAME" label="耗材名称" ></el-table-column>
          <el-table-column prop="FSPEC" label="耗材型号" width="95"></el-table-column>
          <el-table-column prop="FQTY" label="库存数量" width="85"></el-table-column>
          <el-table-column fixed="left" label="操作" align="center" width="100">
            <template slot-scope="scope">
              <el-button type="text" @click="insert(scope.row.FBILLNO)" size="small" icon="el-icon-edit">
                查看详情
              </el-button>
            </template>
          </el-table-column>
        </JNPF-table>
        <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit"/>
        <Form ref="Form"  :formationlist="customlist" />
      </div>
    </div>
  </div>
</template>
<script>
  import Form from "./Form.vue"
  import jnpf from "@/utils/jnpf"
  export default {
    name: 'shop',
    components: { Form },
    data() {
      return {
        showAll: false,

        //所属校区选择数据
        options1: [{
          value: '1',
          label: '奉1教楼101'
        }, {
          value: '2',
          label: '奉1教楼102'
        }, {
          value: '3',
          label: '奉综合楼201'
        }, {
          value: '4',
          label: '奉综合楼202'
        }],


        options2: [{
          value: '1',
          label: '化学系仓库'
        }, {
          value: '2',
          label: '生物系仓库'
        }],

        options3: [{
          value: '10',
          label: '玻璃试管'
        }, {
          value: '20',
          label: '塑料试管'
        }, {
          value: '21',
          label: '实验手套'
        },
       ],

        customlist:[
          {
            "FPARENTNO":"",
            "FLAYNO":"",
            "FPOINT":"",
            "FCATNO":"",
            "FCATNAME":"",
            "FSPEC":"",
            "FQTY":""
          },
        ],
        list: [
            {
            "FSTOCK":"化学系仓库",
            "FCATNO":"玻璃试管",
            "FCATNAME":"玻璃实验室器皿500ml",
            "FSPEC":"500ml",
            "FQTY":"7"
            },{
            "FSTOCK":"化学系仓库",
            "FCATNO":"玻璃试管",
            "FCATNAME":"玻璃实验室器皿200ml",
            "FSPEC":"200ml",
            "FQTY":"3"
            },
            ,{
            "FSTOCK":"化学系仓库",
            "FCATNO":"玻璃试管",
            "FCATNAME":"玻璃实验室器皿200ml",
            "FSPEC":"200ml",
            "FQTY":""
            },{
            "FSTOCK":"化学系仓库",
            "FCATNO":"玻璃试管",
            "FCATNAME":"玻璃实验室器皿200ml",
            "FSPEC":"200ml",
            "FQTY":"5"
            },
        ],
        fbillcredate: [jnpf.dateFormat(new Date(), "YYYY-MM-DD"), jnpf.dateFormat(new Date(), "YYYY-MM-DD")],
        loading: false,
        total: 0,
        listQuery: {
          page: 1,
          limit: 20,
          sort: "desc",
          sidx: "",
          fbillstate: "",
          fbillno: "",
          begindate: undefined,
          enddate: undefined,
          fcustomno: ""
        },
      };
    },
    computed: {},
    methods: {
      insert(id) {
        this.$refs.Form.init(id);
      },
    },
  };
</script>